# -*- coding: utf-8 -*-
# @Time    : 2019/6/26 16:43
# @Author  : Igor
# @File    : log_test.py
# @Software: PyCharm
# @url: https://cloud.tencent.com/developer/article/1354396

import logging

def logger():
    logging.basicConfig(format="%(asctime)s %(filename)s[line:%(lineno)d] %(levelname)s %(message)s", datefmt="%Y-%m-%d %H:%M:%S",handlers=[logging.FileHandler(filename="test.log", encoding="utf-8")], level=logging.ERROR)
    return logging

def test(a,b):
    try:
        return a/b
    except:
        logger().error("被除数不能为0", exc_info=True)

if __name__ == "__main__":
    test(1,0)